package com.zoe.thread.th11_线程池;

import cn.hutool.core.date.DateUtil;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @author zoe.Zhang
 * @date 2022/06/28
 * @description
 */
public class MyThreadDemo_newScheduledThreadPool {

    public static void main(String[] args) {
        ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(3);
        scheduledExecutorService.scheduleAtFixedRate(() -> {
            System.out.println(DateUtil.now());
        }, 5, 1, TimeUnit.SECONDS);
    }
}
